<!DOCTYPE html>
<html lang="ar">
<head>
    <title>قائمة وصولات الطلب</title>
	<?php
	 define('LAST_CAPITRE_ID',19);
	 define('LAST_ARTICLE_CODE',3);
	?>
	
	<?php $this->load->helper('url');?>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta charset="utf-8">
		<!---------------------for autocomplete--------------->
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-1.11.0.min.js');?>" ></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/jquery-ui-1.10.4/js/jquery-ui-1.10.4.min.js');?>" ></script>
	<link href="<?php echo base_url("assets/css/jquery-ui.css")?>" rel="stylesheet" type="text/css" />
	<!------------------------------------------------------>


<script type="text/javascript" src="<?php echo base_url('assets/js/jquery.tablesorter.min.js');?>" ></script>
		<link href="<?php echo base_url("assets/css/table.css")?>" rel="stylesheet" type="text/css" />
	<link href="<?php echo base_url("assets/css/ch_menu.css")?>" rel="stylesheet" type="text/css" />
	 <link href="<?php echo base_url("assets/css/botton.css")?>" rel="stylesheet" type="text/css" />

</head>

<body>
<?php include_once('header.php');
	
	echo('<br><br>');	
		 $this->load->library('session');
        $num_ar=$this->session->userdata('data_charticle'); //access it
        $chcl=$num_ar;
 ?>

<div class="container">


<?php
$liste_des_fournisseurs= array();
foreach ($results_recherche as $lf){
	array_push($liste_des_fournisseurs, $lf->nom);
	}
	

	?>
	
	

	<form id="recherche_frm" method="post" style="width: 30%; display:inline-block;" action="<?php echo base_url("bc_ctr/find_name/");?>" >
	 <fieldset>
	   <div class="pure-g">
	  <div class="pure-u-1 pure-u-md-1-3">
                <label for="nom" style="font-size: 120%"> بحث بالمورد</label>	<br>
				<input id="nom" name="nom" type="text" value="<?php
				 if($results_recherche){
				 	echo($results_recherche[0]->nom);
				 }
				 ?>">
           
		 <button type="submit" id="submit_btn" class="pure-button pure-button-primary">بحث</button>
		   </div> </div>
		  </fieldset>
	</form>

	<!--////////////////////
////////////////////
/////////////////
/////////////////-->


	<form action="<?php echo base_url("bc_ctr/find_bc_per_date/");?>"  method="POST" style="width: 30%; display:inline-block;">
	   <fieldset>
	    <label for="nom" style="font-size: 120%">بحث  بالتاريخ </label><br>
		
		<SELECT name="mois2" Size="1">
		<?php
			for($d=1; $d<=12;$d++)
			{	       //Lister les mois
				if ($d < 10)
				{		       //Lister les jours pour pouvoir leur ajouter un 0 devant
					echo "<OPTION>0$d<br></OPTION>";
				}
				else 
				{
					echo "<OPTION>$d<br></OPTION>";
				}
            }
		?>
		</SELECT>
		 <SELECT name='jour2' Size='1'>
		<?php
			for($i=1; $i<=31;$i++)
			{	       //Lister les jours
				if ($i < 10)
				{		       //Lister les jours pour pouvoir leur ajouter un 0 devant
					echo "<OPTION>0$i<br></OPTION>";
				}
				else 
				{
					echo "<OPTION>$i<br></OPTION>";
				}
            }
			?>
		</SELECT>	
		<label for="nom">من : </label>
		     
		<SELECT name='jour1' Size='1'>
		<?php
			for($i=1; $i<=31;$i++)
			{	       //Lister les jours
				if ($i < 10)
				{		       //Lister les jours pour pouvoir leur ajouter un 0 devant
					echo "<OPTION>0$i<br></OPTION>";
				}
				else 
				{
					echo "<OPTION>$i<br></OPTION>";
				}
            }
			?>
		</SELECT>
		<SELECT name="mois1" Size="1">
		<?php
			for($d=1; $d<=12;$d++)
			{	       //Lister les mois
				if ($d < 10)
				{		       //Lister les jours pour pouvoir leur ajouter un 0 devant
					echo "<OPTION>0$d<br></OPTION>";
				}
				else 
				{
					echo "<OPTION>$d<br></OPTION>";
				}
            }
		?>
		</SELECT>
		 
		<label for="nom">الى </label>
		
		<input type="submit" value="بحث"><br/>
		
		 </fieldset>
		</form>
	
	
	<!--////////////////////
////////////////////
/////////////////
/////////////////-->

<form id="recherche_frm" method="post" action="<?php echo base_url("bc_ctr/find_bc_per_wilaya/");?>" style="width: 30%; display:inline-block;">
	  <fieldset>
	 <label for="nom" style="font-size: 120%">بحث بالولاية </label>	<br>
		<SELECT name="wilaya" Size="1">
		<?php
			foreach($wilaya as $data) 
			{	       //Lister les mois
				
					echo "<OPTION>$data->nom_ar<br></OPTION>";
				
            }
		?>
		</SELECT>
		
		<input type="submit" value="بحث"><br/>
			
	 </fieldset>	 
	</form>
	
	<!--////////////////////
////////////////////
/////////////////
/////////////////-->
<div class = "charticle_browser">
	
<ul class="topmenu" id="css3menu1">
<?php

$mem =0;


for($i = 0; $i < count($chcl); $i++)
{
	if($mem <> $chcl[$i]->id_chapitre)
			{	
				echo('<li class="topmenu"><a style="width:248px;" href="#"><span>
				<img alt="" src="images/sparkle-brown-vertical/info2.png"> '. $chcl[$i]->ch_code.' - '.$chcl[$i]->nom_chap.' </span></a>');
				echo('<div style="auto;" class="submenu">');
				echo('<div style="width:100%" class="column">');

			
				echo('<ul><li><a href="'.base_url("bc_ctr/get_bc_per_article2/").'/'.$chcl[$i]->id_article.'">
				<img alt="" src="images/sparkle-brown-vertical/bookmarks.png">'.$chcl[$i]->code.'- '.$chcl[$i]->nom_art.'</a></li><br>');

				if(($chcl[$i]->code)== 1 && ($chcl[$i]->id_chapitre == 16))  echo('</ul></div></div></li>'); // patch to fix a unique child
				
			}
			else
			{

				
				echo('<li><a href="'.base_url("bc_ctr/get_bc_per_article2/").'/'.$chcl[$i]->id_article.'">
				<img alt="" src="images/sparkle-brown-vertical/bookmarks.png">'.$chcl[$i]->code.'- '.$chcl[$i]->nom_art.'</a></li><br>');

				if($chcl[$i+1]->id_chapitre > $mem) echo('</ul></div></div></li>');
				if(($chcl[$i]->code)== 2 && ($chcl[$i]->id_chapitre == 19))  //if last chapitre et article
				 {

				 
				 	echo('<li><a href="'.base_url("bc_ctr/get_bc_per_article2/").'/'.$chcl[$i]->id_article.'">
					<img alt="" src="images/sparkle-brown-vertical/bookmarks.png">'.$chcl[$i]->code.'- '.$chcl[$i+1]->nom_art.'</a></li><br>');

				 	 echo('</ul></div></div></li>');
					//goto end;
					break;
				 }
			}
			    $mem = $chcl[$i]->id_chapitre;	
}	
 ?>
 </ul>
 </div>
</div>

<div id="destination" >
  <h1><?php echo $titre;   ?></h1>
  <div id="body">
  
  
    <div class="CSS_Table_Example" >
   <table id="myTable" class="tablesorter">
  <thead>
<tr>
 <th>    التاريخ    </th>
  <th>     المبلغ  </th>
  <th>    حوالة الدفع   </th>
  <th>    الالتزام    </th> 
 <th>    المادة   </th>

   <th> المورد  </th>
 <th>  وصل الطلب</th>
</tr>
</thead>
<?php
$rmq=0; // var utilise pour savoire que ce fournisseur a besoin de convention de regularisation
foreach($results as $data) 
{

	echo '<tr >
	<td>'.$data->date.'</td>
	 <td>'.$data->montant.'</td>
	 <td>'.$data->num_mondat.'</td>
	  <td>'.$data->num_engagement.'</td>
	 <td>'.$data->num_article.'</td>	 
	
	   <td>'.$data->fournisseur.'</td>	 
<td> <a href='.base_url("/bc_ctr/verifie_seuill_fournisseur/$data->id_fournisseur_fk/$data->id_bc").'>'.$data->numero.'</a></td>
    
	  
	  
		  </tr>'  ;
	
}
   $goupe=$this->session->userdata('user_group'); //access it
  $msg=0; // msg la ne fait rien mais elle indispensable pour appeller ajout_bc et ajout un boton
?>
</table>
</div>
<div class="pagination_numero">
  <p><?php echo $links;   ?></p>
 </div>
 <div>  
<form  style="position: relative; left: 10%;">
<a href="<?php echo base_url("/budget_ctr/load/")?>" class="botton">خروج</a>
<?php
if($goupe=="admin"){
echo ('<a href="'. base_url('/bc_ctr/ajout_bc/').'/'.$msg .'" class="botton">اضافة</a>');
}

?>
</form> 
</div>
  </div>
 
</div>
</body>
  <script>
 $(document).ready(function() 
    { 
        $("#myTable").tablesorter(); 
    } 
); 
 </script>   
 <script>
$(function() {
	var liste_fourniss = <?php echo json_encode($liste_des_fournisseurs); ?>;
	$( "#nom" ).autocomplete({source: liste_fourniss});
	} 
); 
</script>
</html>